# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#作者：cacho_37967865
#博客：https://blog.csdn.net/sinat_37967865
#文件：playwright_model.py
#日期：2023-11-25
#备注：web自动化测试，pip install pillow Playwright /playwright install
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

from playwright.sync_api import sync_playwright
def run(playwright):
    browser = playwright.chromium.launch(headless=False)
    context = browser.new_context()
    # Open new page
    page = context.new_page()
    # Go to https://www.baidu.com/
    page.goto("https://www.baidu.com/")
    # Click text=这场盛会有何看点
    with page.expect_popup() as popup_info:
        page.click("text=这场盛会有何看点")
    page1 = popup_info.value
    # ---------------------
    context.close()
    browser.close()
with sync_playwright() as playwright:
    run(playwright)